package com.kkwrite.regimen.consumer.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by lisha on 2018/7/9 15:48.
 *
 * @author lisha
 */
@ControllerAdvice
public class ExceptionHandle {

    @ExceptionHandler(value=Exception.class)
    @ResponseBody
    public Map<String, String> handle(Exception e) {
        Map<String, String> out = new HashMap<>(4);
        out.put("success", "false");
        out.put("msg", "异常：" + e.getMessage());
        return out;
    }

}
